﻿@using ARchGL.Declaration.Platform.Service.Dtos
@using TDF.Core.Models
<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <span id="module">佛吉亚管理</span>
            <i class="fa fa-angle-right"></i>
        </li>
        <li>
            <span id="action">推车列表</span>
        </li>
    </ul>
</div>
<!-- END PAGE BAR -->
<div class="mt-bootstrap-tables" style="margin-top: 20px">
    <div class="row">
        <div class="col-md-12">
            <div class="portlet light bordered">
                @*<div class="portlet-title">
                        <div class="caption">
                            <i class="icon-social-dribbble font-green hide"></i>
                        </div>
                        <div class="actions">
                            <a class="btn btn-default" href="javascript:Edit(null);">
                                <i class="fa fa-plus"></i>调整库存
                            </a>
                        </div>
                    </div>*@
                <div class="portlet-body">
                    <!-- BEGIN FORM-->
                    <form id="defaultForm" class="form-horizontal" method="post" novalidate="novalidate">
                        <div class="mt-checkbox-inline" style="margin-top: -37px">
                            <div class="row pull-left" style="margin-top: 18px">
                                <div class="col-md-12 col-sm-12">
                                    @*<label>
                                            Show <select name="sample_1_length" aria-controls="sample_1" class="form-control input-sm input-xsmall input-inline">
                                                <option value="5">5</option>
                                                <option value="15">15</option>
                                                <option value="20">20</option>
                                                <option value="-1">All</option>
                                            </select>
                                        </label>*@

                                    <div style="display: inline-flex;">
                                        <label class="control-label">时间范围：</label>
                                        <div class="input-group input-large date-picker input-daterange" style="width: 120%; margin-top: 3px" data-date="2016-07-19" data-date-format="yyyy-mm-dd">
                                            <input type="text" class="form-control" name="CreatedTimeRange" value="" required>
                                            <span class="input-group-addon"> 到 </span>
                                            <input type="text" class="form-control" name="CreatedTimeRange" value="" required>
                                        </div>&nbsp;
                                    </div>

                                    类型：
                                    <select class="form-control input-inline" name="Operation" id="Operation">
                                        <option value="0">全部</option>
                                        <option value="1">入库</option>
                                        <option value="2">出库</option>
                                        <option value="3">盘盈</option>
                                        <option value="4">盘亏</option>
                                        <option value="5">变更</option>
                                    </select>

                                    产品：
                                    <select class="form-control input-inline" name="ProductId" id="ProductId">
                                        <option value="00000000-0000-0000-0000-000000000000">全部</option>
                                        @if (ViewBag.ProductList != null && ViewBag.ProductList.Count > 0)
                                        {
                                            foreach (var item in ViewBag.ProductList)
                                            {
                                                <option @(ViewBag.ProductId == item.Id.ToString() ? "selected=selected" : "") value="@item.Id">@string.Join(" ", item.Propertys)</option>
                                            }
                                        }
                                    </select>

                                    机位：
                                    <select class="form-control input-inline" name="MachineId" id="MachineId">
                                        <option value="0">全部</option>
                                        @if (ViewBag.MachineList != null && ViewBag.MachineList.Count > 0)
                                        {
                                            foreach (var item in ViewBag.MachineList)
                                            {
                                                <option value="@item.Id">@item.Number</option>
                                            }
                                        }
                                    </select>

                                    车号：
                                    <select class="form-control input-inline" name="CarNumber" id="CarNumber">
                                        <option value="">全部</option>
                                        @if (ViewBag.CarList != null && ViewBag.CarList.Count > 0)
                                        {
                                            foreach (var item in ViewBag.CarList)
                                            {
                                                <option value="@item.Number">@item.Number</option>
                                            }
                                        }
                                    </select>
                                </div>
                            </div>
                        </div>
                    </form>
                    <!-- END FORM-->
                    <table id="table-pagination" data-toggle="table" data-url="@Url.Action("GetWarehouseRecordPagedList", new { ProductId = ViewBag.ProductId})"
                           data-height="526"
                           data-form-id="defaultForm"
                           data-show-refresh="true"
                           data-page-size="10"
                           data-page-list="[5, 10, 20, 50, 100, 200]"
                           data-auto-height="true"
                           data-search="true">
                        <thead>
                        <tr>
                            <th data-formatter="RowNumber" data-width="50">序号</th>
                            <th data-field="ProductName">产品</th>
                            <th data-field="MachineNumber">机位</th>
                            @*<th data-field="TagKey">标签号</th>*@
                            <th data-field="CarNumber">车号</th>
                            <th data-align="right" data-field="ProductCount" data-width="100">产品数</th>
                            <th data-align="center" data-formatter="opColumns"data-width="100">类型</th>
                            <th data-align="center" data-field="CreatedTime" data-width="220">时间</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

@section scripts{
    <script type="text/javascript">
        var opColumns = function(value, row, index) {
            return ['-', '入库', '出库', '盘盈', '盘亏', '变更'][row.Operation];
        };
    </script>
}
